'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')

// 根据命令配置URL
let params = process.argv[4]
// 默认URL
let baseUrl = '"http://192.168.1.67:9001"';
let mqttUrl = '"ws://192.168.0.62:9555/mqtt"';
switch (params) {
  // 鹏哥本地测试
  case '--env=test':
    baseUrl = '"http://192.168.1.155:8091"';
    break;
  // 家辉本地测试
  case '--env=jiahui':
    baseUrl = '"http://192.168.1.136:8080"';
    break;
  // 线上
  case '--env=prod':
    baseUrl = '"http://121.4.72.232:9001"';
    mqttUrl = '"ws://47.99.82.192:9555/mqtt"';
    break;
  default:
  // ...
}

module.exports = merge(prodEnv, {
  NODE_ENV: '"development"',
  // BASE_URL: '"https://httpbin.org"'
  BASE_URL: baseUrl,
  MQTT_URL: mqttUrl,
})
